package com.fjec.base.schedule;

import com.fjec.base.schedule.handler.DelAnnexHandler;
import com.fjec.common.util.JsonUtil;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.xxl.job.core.log.XxlJobLogger;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class BaseSchedule {

    @Resource
    private DelAnnexHandler delAnnexHandler;

    /**
     * ShopNum生成补偿
     *
     * @param param
     * @return
     */
    @XxlJob("delAnnexHandler")
    public ReturnT<String> delAnnexHandler(String param) {
        // 处理参数
        String[] args = param.split(",");
        int limit = Integer.valueOf(args[0]).intValue();
        int days = Integer.valueOf(args[1]).intValue();
        // 执行并写入日志
        String log = delAnnexHandler.handle(limit, days);
        XxlJobLogger.log(log);
        ReturnT<String> returnT = ReturnT.SUCCESS;
        returnT.setMsg(log);
        return returnT;
    }
}
